#ifndef TIMERCLIENT_H
#define TIMERCLIENT_H

#include <QObject>
#include <QTcpSocket>

class TimerClient : public QObject
{
    Q_OBJECT
public:
    explicit TimerClient(QObject *parent = 0);
    ~TimerClient();

    void Connect(const QString &ip,int port);
    void Disconnect();
    int  Send(const char* txt, int len);
    void SetName(const QString &name);
    bool isConnect();
signals:
    void processMsg(const QString &name, const QString &head, const QString &content,qint64 diffTime);
public slots:
    void handle_connected();
    void handle_disconnected();
    void handle_readyRead();
    void handle_error(QAbstractSocket::SocketError);

private:
    QTcpSocket *m_socket;
    bool m_isConnected;
    QString m_Name;
    qint64 m_detectTime;
    qint64 m_diffTime;
};

#endif // TIMERCLIENT_H
